package com.web.common.controller;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.web.common.utils.DES;

@Controller  
@RequestMapping("/")  
public class RenderController {
	
	@RequestMapping(value="/login",method=RequestMethod.GET)
	public String login(HttpServletRequest request,Model model){
		Cookie[] cookies = request.getCookies();
		if(cookies != null){
			for(Cookie cookie : cookies){
				String name = cookie.getName();
				if(name != null && name.equals(AuthController.COOKIE_EMAIL)){
					String value = cookie.getValue();
					request.getSession().setAttribute(AuthController.COOKIE_EMAIL, value);
				}
			}
		}
		return "login/loginPage";
	}
	
	@RequestMapping(value="/upload",method=RequestMethod.GET)
	public String uploadPage(HttpServletRequest request,Model model){
		return "filemanage/uploadPage";
	}
	
	
}
